Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevEng: Don't produce HasIndex() API if it would already be assumed #4039

Closed

Conversation

lajones
Copy link
Contributor

@lajones lajones commented Dec 10, 2015

Due to supporting a primary key, but make allowance for the outputting
HasName() (on a primary key) or HasConstraintName() (on a foreign key) as needed.

Fix for #3710.

supporting a primary key, but make allowance for the outputting
HasName() (on a primary key) or HasConstraintName() (on a foreign key) as needed.
@@ -14,7 +14,8 @@ namespace E2E.Sqlite
{
modelBuilder.Entity<OneToManyDependent>(entity =>
{
entity.HasKey(e => new { e.OneToManyDependentID1, e.OneToManyDependentID2 });
entity.HasKey(e => new { e.OneToManyDependentID1, e.OneToManyDependentID2 })
.HasName("sqlite_autoindex_OneToManyDependent_1");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we suppress this behavior for SQLite? SQLite ignores attempts to set the constraint name on the primary key.

CREATE TABLE People ( Id INT, CONSTRAINT "PK_People" PRIMARY KEY ( Id ) );
-- done.
SELECT * FROM sqlite_master;
-- shows the index created is named "sqlite_autoindex_People_1"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed this with @natemcmaster offline. SQLite won't do anything with it this extra API and it should cause no problems. This seems to be something we should address in a SQLite-specific codegen layer, but we don't have that at the moment pending decisions in #4038. So checking in as is. Will discuss as part of #4038.

@natemcmaster
Copy link
Contributor

:shipit:

@lajones
Copy link
Contributor Author

lajones commented Dec 16, 2015

Checked in with commit dbb5c9f.

@lajones lajones closed this Dec 16, 2015
@lajones lajones added this to the 7.0.0-rc2 milestone Dec 16, 2015
@lajones lajones self-assigned this Dec 16, 2015
@smitpatel smitpatel deleted the 151210-lajones_DontGenerateUnnecessaryIndexes_02 branch December 16, 2015 23:25
@ajcvickers ajcvickers removed this from the 1.0.0-rc2 milestone Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants